#vertex shader

#version 130

uniform mat4 modelviewMatrix;
uniform mat4 projectionMatrix;

in vec3 vertex_in;
in vec3 normal_in;
in vec2 texcoord_in;

out vec2 texcoord;

void main() {
	texcoord = texcoord_in;
	gl_Position = projectionMatrix * modelviewMatrix * vec4(vertex_in, 1.0);
}

#fragment shader

#version 130

uniform sampler2D tex;
uniform vec4 color;
uniform int useTexture;

in vec2 texcoord;

out vec4 fragColor;
 
void main() {
	vec4 pixelColor = texture(tex, texcoord);
	
	if(useTexture == 0) {
		pixelColor = vec4(1.0, 1.0, 1.0, 1.0);
	}
	
    fragColor = pixelColor * color;
}